package com.warren.beans.factory.config;

import com.warren.beans.factory.BeanFactory;
import com.warren.error.BeansException;

/**
 * @author warren
 * @create 2021-08-19 22:17
 * @Description 由能够自动装配的 bean 工厂实现的接口扩展，前提是它们希望为现有 bean 实例公开此功能
 */
public interface AutowireCapableBeanFactory extends BeanFactory {
    /**
     * 执行 BeanPostProcessors 接口实现类的 postProcessBeforeInitialization 方法
     *
     * @param existingBean
     * @param beanName
     * @return
     * @throws BeansException
     */
    Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, String beanName) throws BeansException;

    /**
     * 执行 BeanPostProcessors 接口实现类的 postProcessorsAfterInitialization 方法
     *
     * @param existingBean
     * @param beanName
     * @return
     * @throws BeansException
     */
    Object applyBeanPostProcessorsAfterInitialization(Object existingBean, String beanName) throws BeansException;
}
